<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        img {
            width: 400px;
            height: 400px;
        }

        div {
            position: relative;
        }

        .right {
            position: absolute;
            top: 190px;
            left: 360px;
            width: 40px;
            height: 50px;
            background-color: gray;
        }

        .left {
            position: absolute;
            top: 190px;
            left: 0px;
            width: 40px;
            height: 50px;
            background-color: gray;
        }

        a {
            user-select: none;
            text-decoration: none;
        }
    </style>
</head>

<body>
    <div id="app">
        <img :src="arr[a]" alt="" />
        <a href="#" class="right" @click="next" v-show="a<arr.length-1">右边</a>
        <a href="#" class="left" @click="prev" v-show="a!=0">左边</a>

    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <script>
        var app = new Vue({
            el: "#app",
            data: {
                arr: ["./img/1.jpg", "./img/2.jpg", "./img/3.jpg"],
                a: 0,
            },
            methods: {
                prev() {
                    this.a--

                },
                next() {

                    this.a++
                    console.log(this.a)
                }
            }

        })
    </script>
</body>

</html>